<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        //函数是可以相互调用的
        //买土豆
        function buy() {
            console.log('去超市');
            console.log('挑选土豆');
            return '土豆';
        }
        //用土豆炖牛肉
        function beef() {
            let potato = buy();
            console.log('切' + potato);
            console.log('做菜');
            console.log('土豆做好了');
        }
        //大盘鸡
        function chicken() {
            //直接调用买土豆的方法即可
            let potato = buy();
            console.log('切' + potato);
            console.log('处理鸡子');
            console.log('一份大盘鸡做好了');
        }
        beef();
        chicken();
        //土豆方法复用
    </script>
</body>

</html>